home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.2 Development Libraries / SGI IRIX 6.2 Development Libraries.iso / dist / sgitcl_dev.idb / usr / sgitcl / include / tclExtdInt.h.z / tclExtdInt.h
C/C++ Source or Header  |  1996-03-14  |  14KB  |  593 lines

  1. /*
  2.  * tclExtdInt.h
  3.  *
  4.  * Standard internal include file for Extended Tcl library..
  5.  *-----------------------------------------------------------------------------
  6.  * Copyright 1991-1995 Karl Lehenbauer and Mark Diekhans.
  7.  *
  8.  * Permission to use, copy, modify, and distribute this software and its
  9.  * documentation for any purpose and without fee is hereby granted, provided
  10.  * that the above copyright notice appear in all copies.  Karl Lehenbauer and
  11.  * Mark Diekhans make no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without express or
  13.  * implied warranty.
  14.  *-----------------------------------------------------------------------------
  15.  * $Id: tclExtdInt.h,v 1.7 1995/08/03 00:50:49 jes Exp $
  16.  *-----------------------------------------------------------------------------
  17.  */
  18.  
  19. #ifndef TCLEXTDINT_H
  20. #define TCLEXTDINT_H
  21.  
  22. #include "tclExtend.h"
  23. #include "tclXconf.h"
  24. #include "tclInt.h"
  25.  
  26. #include <sys/param.h>
  27.  
  28. /*
  29.  * Use the real functions, not the Tcl interface that hides signals.
  30.  */
  31. #undef open
  32. #undef read
  33. #undef waitpid
  34. #undef write
  35.  
  36. /*
  37.  * If tclUnix.h has already included time.h, don't include it again, some
  38.  * systems don't #ifdef inside of the file.
  39.  */
  40. #ifndef NO_SYS_TIME_H
  41. #    include <time.h>
  42. #endif
  43.  
  44. #include <sys/times.h>
  45.  
  46. /*
  47.  * Make sure CLK_TCK is defined.
  48.  */
  49. #ifndef CLK_TCK
  50. #    ifdef HZ
  51. #        define CLK_TCK HZ
  52. #    else
  53. #        define CLK_TCK 60
  54. #    endif
  55. #endif
  56.  
  57. #include <math.h>
  58.  
  59. #ifdef NO_VALUES_H
  60. #    include <limits.h>
  61. #else
  62. #    include <values.h>
  63. #endif
  64.  
  65. #ifndef MAXDOUBLE
  66. #    define MAXDOUBLE HUGE_VAL
  67. #endif
  68.  
  69. #include <grp.h>
  70.  
  71. /*
  72.  * Included the tcl file tclUnix.h after other system files, as it checks
  73.  * if certain things are defined.
  74.  */
  75. #include "tclPort.h"
  76.  
  77. /*
  78.  * These should be take from an include file, but it got to be such a mess
  79.  * to get the include files right that they are here for good measure.
  80.  */
  81. struct tm *gmtime ();
  82. struct tm *localtime ();
  83.  
  84.  
  85. /*
  86.  * Get ranges of integers and longs.
  87.  *  If no MAXLONG, assume sizeof (long) == sizeof (int).
  88.  */
  89.  
  90. #ifndef MAXINT
  91. #    ifdef INT_MAX    /* POSIX */
  92. #        define MAXINT INT_MAX
  93. #    else
  94. #        define BITSPERBYTE   8
  95. #        define BITS(type)    (BITSPERBYTE * (int)sizeof(type))
  96. #        define HIBITI        (1 << BITS(int) - 1)
  97. #        define MAXINT        (~HIBITI)
  98. #    endif
  99. #endif
  100.  
  101. #ifndef MININT
  102. #    ifdef INT_MIN        /* POSIX */
  103. #        define MININT INT_MIN
  104. #    else
  105. #        define MININT (-MAXINT)-1
  106. #    endif
  107. #endif
  108.  
  109. #ifndef MAXLONG
  110. #    ifdef LONG_MAX /* POSIX */
  111. #        define MAXLONG LONG_MAX
  112. #    else
  113. #        define MAXLONG MAXINT  
  114. #    endif
  115. #endif
  116.  
  117. /*
  118.  * Boolean constants.
  119.  */
  120. #ifndef TRUE
  121. #    define TRUE   (1)
  122. #    define FALSE  (0)
  123. #endif
  124.  
  125. /*
  126.  * Structure to hold a regular expression, plus a Boyer-Moore compiled
  127.  * pattern.  Also structure to return submatch info.
  128.  */
  129.  
  130. typedef struct {
  131.     regexp *progPtr;
  132.     char   *boyerMoorePtr;
  133.     int     noCase;
  134.     int     numSubExprs;
  135. } TclX_regexp;
  136.  
  137. typedef struct {
  138.     int start;
  139.     int end;
  140. } Tcl_SubMatchInfo [NSUBEXP];
  141.  
  142. /*
  143.  * Flags used by TclX_RegExpCompile:
  144.  */
  145. #define TCLX_REXP_NO_CASE         1   /* Do matching regardless of case    */
  146. #define TCLX_REXP_BOTH_ALGORITHMS 2   /* Use boyer-moore along with regexp */
  147.  
  148. /*
  149.  * Flags used by TclX_Eval and friends.
  150.  */
  151. #define TCLX_EVAL_GLOBAL          1  /* Evaluate in the global environment.*/
  152. #define TCLX_EVAL_FILE            2  /* Read and evaluate a file.          */
  153. #define TCLX_EVAL_ERR_HANDLER     4  /* Call error handler on error.       */
  154.  
  155. /*
  156.  * Used to return argument messages by most commands.
  157.  */
  158. extern char *tclXWrongArgs;
  159.  
  160. /*
  161.  * Macros to do string compares.  They pre-check the first character before
  162.  * checking of the strings are equal.
  163.  */
  164.  
  165. #define STREQU(str1, str2) \
  166.         (((str1) [0] == (str2) [0]) && (strcmp (str1, str2) == 0))
  167. #define STRNEQU(str1, str2, cnt) \
  168.         (((str1) [0] == (str2) [0]) && (strncmp (str1, str2, cnt) == 0))
  169.  
  170. /*
  171.  * Macro to do ctype functions with 8 bit character sets.
  172.  */
  173. #define ISSPACE(c) (isspace ((unsigned char) c))
  174. #define ISDIGIT(c) (isdigit ((unsigned char) c))
  175. #define ISLOWER(c) (islower ((unsigned char) c))
  176.  
  177. /*
  178.  * Macro that behaves like strdup, only uses ckalloc.
  179.  */
  180. #define ckstrdup(sourceStr) \
  181.   (strcpy (ckalloc (strlen (sourceStr) + 1), sourceStr))
  182.  
  183.  
  184. /*
  185.  * Macros to get the stdin, stdout and stderr pointers out of the interpreter
  186.  * when error status is not desired.
  187.  */
  188. #define TCL_STDIN \
  189.     (((tclNumFiles < 1) || (tclOpenFiles [0] == NULL)) ? \
  190.      stdin : tclOpenFiles [0]->f)
  191.  
  192. #define TCL_STDOUT \
  193.     (((tclNumFiles < 2) || (tclOpenFiles [1] == NULL)) ? \
  194.      stdout : \
  195.       ((tclOpenFiles [1]->f2 != NULL) ? tclOpenFiles [1]->f2 : \
  196.        tclOpenFiles [1]->f))
  197.  
  198. #define TCL_STDERR \
  199.     (((tclNumFiles < 3) || (tclOpenFiles [2] == NULL)) ? \
  200.      stderr : \
  201.       ((tclOpenFiles [2]->f2 != NULL) ? tclOpenFiles [2]->f2 : \
  202.        tclOpenFiles [2]->f))
  203.  
  204.  
  205. /*
  206.  * Prototypes for utility procedures.
  207.  */
  208. extern void
  209. Tcl_CloseForError _ANSI_ARGS_((Tcl_Interp *interp,
  210.                                int         fileNum));
  211.  
  212. extern int
  213. Tcl_CommandLoop _ANSI_ARGS_((Tcl_Interp *interp,
  214.                              int         interactive));
  215.  
  216. extern int
  217. Tcl_StrToOffset _ANSI_ARGS_((CONST char *string,
  218.                              int         base,
  219.                              off_t      *offsetPtr));
  220.  
  221. extern int
  222. Tcl_DStringGets _ANSI_ARGS_((FILE         *filePtr,
  223.                              Tcl_DString  *dynStrPtr));
  224.  
  225. extern int
  226. TclX_Eval _ANSI_ARGS_((Tcl_Interp  *interp,
  227.                        unsigned     options,
  228.                        char        *cmd));
  229.  
  230. extern int
  231. TclX_VarEval ();
  232.  
  233. extern int
  234. Tcl_GetDate _ANSI_ARGS_((char   *p,
  235.                          time_t  now,
  236.                          long    zone,
  237.                          time_t *timePtr));
  238.  
  239. extern OpenFile *
  240. Tcl_GetOpenFileStruct _ANSI_ARGS_((Tcl_Interp *interp,
  241.                                    char       *handle));
  242.  
  243. extern int
  244. Tcl_GetTime _ANSI_ARGS_((Tcl_Interp *interp,
  245.                          CONST char *string,
  246.                          time_t     *timePtr));
  247.  
  248. extern int
  249. Tcl_GetOffset _ANSI_ARGS_((Tcl_Interp *interp,
  250.                            CONST char *string,
  251.                            off_t      *offsetPtr));
  252.  
  253. extern int
  254. Tcl_ProcessSignal _ANSI_ARGS_((ClientData  clientData,
  255.                                Tcl_Interp *interp,
  256.                                int         cmdResultCode));
  257.  
  258. extern void
  259. TclX_RegExpClean _ANSI_ARGS_((TclX_regexp *regExpPtr));
  260.  
  261. extern int
  262. TclX_RegExpCompile _ANSI_ARGS_((Tcl_Interp   *interp,
  263.                                 TclX_regexp  *regExpPtr,
  264.                                 char         *expression,
  265.                                 int          flags));
  266.  
  267. extern int
  268. TclX_RegExpExecute _ANSI_ARGS_((Tcl_Interp       *interp,
  269.                                 TclX_regexp      *regExpPtr,
  270.                                 char             *matchStrIn,
  271.                                 char             *matchStrLower,
  272.                                 Tcl_SubMatchInfo  subMatchInfo));
  273.  
  274.  
  275. extern int
  276. Tcl_RelativeExpr _ANSI_ARGS_((Tcl_Interp  *interp,
  277.                               char        *cstringExpr,
  278.                               long         stringLen,
  279.                               long        *exprResultPtr));
  280.  
  281. extern void
  282. Tcl_ResetSignals ();
  283.  
  284. extern FILE *
  285. Tcl_SetupFileEntry _ANSI_ARGS_((Tcl_Interp *interp,
  286.                                 int         fileNum,
  287.                                 int         permissions));
  288.  
  289. extern FILE *
  290. Tcl_SetupFileEntry2  _ANSI_ARGS_((Tcl_Interp *interp,
  291.                                   int         readFileNum,
  292.                                   int         writeFileNum,
  293.                                   FILE      **writeFilePtrPtr));
  294.  
  295. extern clock_t
  296. Tcl_TicksToMS _ANSI_ARGS_((clock_t numTicks));
  297.  
  298. /*
  299.  * Definitions required to initialize all extended commands.  These are either
  300.  * the command executors or initialization routines that do the command
  301.  * initialization.  The initialization routines are used when there is more
  302.  * to initializing the command that just binding the command name to the
  303.  * executor.  Usually, this means initializing some command local data via
  304.  * the ClientData mechanism.  The command executors should be declared to be of
  305.  * type `Tcl_CmdProc', but this blows up some compilers, so they are declared
  306.  * with an ANSI prototype.
  307.  */
  308.  
  309. /*
  310.  * from tclXbsearch.c
  311.  */
  312. extern int 
  313. Tcl_BsearchCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  314.  
  315. /*
  316.  * from tclXchmod.c
  317.  */
  318. extern int 
  319. Tcl_ChmodCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  320.  
  321. extern int 
  322. Tcl_ChownCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  323.  
  324. extern int 
  325. Tcl_ChgrpCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  326.  
  327. /*
  328.  * from tclXclock.c
  329.  */
  330. extern int 
  331. Tcl_GetclockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  332.  
  333. extern int 
  334. Tcl_FmtclockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  335.  
  336. /*
  337.  * from tclXcnvclock.c
  338.  */
  339. extern int 
  340. Tcl_ConvertclockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  341.  
  342. /*
  343.  * from tclXcmdloop.c
  344.  */
  345. extern int 
  346. Tcl_CommandloopCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  347.  
  348. /*
  349.  * from tclXdebug.c
  350.  */
  351. extern void
  352. Tcl_InitDebug _ANSI_ARGS_((Tcl_Interp *interp));
  353.  
  354. /*
  355.  * from tclXdup.c
  356.  */
  357. extern int 
  358. Tcl_DupCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  359.  
  360. /*
  361.  * from tclXfcntl.c
  362.  */
  363. extern int 
  364. Tcl_FcntlCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  365.  
  366. /*
  367.  * from tclXfilecmds.c
  368.  */
  369. extern int 
  370. Tcl_PipeCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  371.  
  372. extern int 
  373. Tcl_CopyfileCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  374.  
  375. extern int 
  376. Tcl_LgetsCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  377.  
  378. extern int 
  379. Tcl_FrenameCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  380.  
  381. extern int
  382. Tcl_FtruncateCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  383.  
  384. extern int
  385. Tcl_ReaddirCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  386.  
  387. /*
  388.  * from tclXfstat.c
  389.  */
  390. extern int 
  391. Tcl_FstatCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  392.  
  393. /*
  394.  * from tclXflock.c
  395.  */
  396. extern int
  397. Tcl_FlockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  398.  
  399. extern int
  400. Tcl_FunlockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  401.  
  402. /*
  403.  * from tclXfilescan.c
  404.  */
  405. extern void
  406. Tcl_InitFilescan _ANSI_ARGS_((Tcl_Interp *interp));
  407.  
  408. /*
  409.  * from tclXgeneral.c
  410.  */
  411.  
  412. extern int 
  413. Tcl_EchoCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  414.  
  415. extern int 
  416. Tcl_InfoxCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  417.  
  418. extern int 
  419. Tcl_LoopCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  420.  
  421. /*
  422.  * from tclXid.c
  423.  */
  424. extern int 
  425. Tcl_IdCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  426.  
  427. /*
  428.  * from tclXkeylist.c
  429.  */
  430. extern int 
  431. Tcl_KeyldelCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  432.  
  433. extern int 
  434. Tcl_KeylgetCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  435.  
  436. extern int 
  437. Tcl_KeylkeysCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  438.  
  439. extern int 
  440. Tcl_KeylsetCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  441.  
  442. /*
  443.  * from tclXlib.c
  444.  */
  445. extern int 
  446. TclX_LibraryInit _ANSI_ARGS_((Tcl_Interp *interp));
  447.  
  448. /*
  449.  * from tclXlist.c
  450.  */
  451. extern int 
  452. Tcl_LvarpopCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  453.  
  454. extern int 
  455. Tcl_LvarcatCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  456.  
  457. extern int 
  458. Tcl_LvarpushCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  459.  
  460. extern int 
  461. Tcl_LemptyCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  462.  
  463. extern int 
  464. Tcl_LassignCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  465.  
  466. extern int 
  467. Tcl_LmatchCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  468.  
  469. /*
  470.  * from tclXmath.c
  471.  */
  472. extern void
  473. Tcl_InitMath _ANSI_ARGS_((Tcl_Interp*));
  474.  
  475. /*
  476.  * from tclXmsgcat.c
  477.  */
  478. extern void
  479. Tcl_InitMsgCat _ANSI_ARGS_((Tcl_Interp *interp));
  480.  
  481. /*
  482.  * from tclXprocess.c
  483.  */
  484. extern int 
  485. Tcl_ExeclCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  486.  
  487. extern int 
  488. Tcl_ForkCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  489.  
  490. extern int 
  491. Tcl_WaitCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  492.  
  493. /*
  494.  * from tclXprofile.c
  495.  */
  496. void
  497. Tcl_InitProfile _ANSI_ARGS_((Tcl_Interp *interp));
  498.  
  499. /*
  500.  * from tclXselect.c
  501.  */
  502. extern int 
  503. Tcl_SelectCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  504.  
  505. /*
  506.  * from tclXsignal.c
  507.  */
  508. extern void
  509. Tcl_InitSignalHandling _ANSI_ARGS_((Tcl_Interp *interp));
  510.  
  511. /*
  512.  * from tclXstring.c
  513.  */
  514. extern int 
  515. Tcl_CindexCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  516.  
  517. extern int 
  518. Tcl_ClengthCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  519.  
  520. extern int 
  521. Tcl_CrangeCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  522.  
  523. extern int 
  524. Tcl_CcollateCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  525.  
  526. extern int 
  527. Tcl_ReplicateCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  528.  
  529. extern int 
  530. Tcl_TranslitCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  531.  
  532. extern int 
  533. Tcl_CtypeCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  534.  
  535. extern int 
  536. Tcl_CtokenCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  537.  
  538. extern int 
  539. Tcl_CequalCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  540.  
  541. /*
  542.  * from tclXlib.c
  543.  */
  544. extern void
  545. Tcl_InitLibrary _ANSI_ARGS_((Tcl_Interp *interp));
  546.  
  547. /*
  548.  * from tclXunixcmds.c
  549.  */
  550. extern int 
  551. Tcl_AlarmCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  552.  
  553. extern int 
  554. Tcl_ChrootCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  555.  
  556. extern int 
  557. Tcl_NiceCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  558.  
  559. extern int 
  560. Tcl_SleepCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  561.  
  562. extern int 
  563. Tcl_SyncCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  564.  
  565. extern int 
  566. Tcl_SystemCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  567.  
  568. extern int 
  569. Tcl_TimesCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  570.  
  571. extern int 
  572. Tcl_UmaskCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  573.  
  574. extern int 
  575. Tcl_LinkCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  576.  
  577. extern int 
  578. Tcl_UnlinkCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  579.  
  580. extern int 
  581. Tcl_MkdirCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  582.  
  583. extern int 
  584. Tcl_RmdirCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  585.  
  586. /*
  587.  * from tclXserver.c
  588.  */
  589. extern void
  590. Tcl_ServerInit _ANSI_ARGS_((Tcl_Interp*));
  591.  
  592. #endif
  593.